﻿using IdentityService.Domain.Aggregates.PermitAggregate;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace IdentityService.Infrastructure.EntitiesConfig
{
    public class PermitConfig : IEntityTypeConfiguration<Permit>
    {
        public void Configure(EntityTypeBuilder<Permit> builder)
        {
            builder.HasKey(it => it.Id);
            builder.Property(it => it.Id).ValueGeneratedNever();
            builder.HasMany(it => it.Children).WithOne().HasForeignKey(it => it.ParentId);
        }
    }
}
